<%@include file="../../generic/inc/head.jsp"%>

<%@ page import="fr.mywiki.view.web.struts.action.entry.EditEntryAction" %>

<script>

function editEntry() {
	document.forms["entryPageForm"].method.value='editEntry';
	document.forms["entryPageForm"].submit();
}

function seeHistory() {
	document.forms["entryPageForm"].method.value='seeHistory';
	document.forms["entryPageForm"].submit();
}

function deleteEntry() {
	if(confirm('<bean:message key="entry.remove.confirm"/>')) {
		document.forms["entryPageForm"].method.value='deleteEntry';
		document.forms["entryPageForm"].submit();
	}
}

</script>

<div id="mainPanel">
	<html:form action="entryPage">
		<html:hidden property="method" value="validate" />
		<html:hidden property="<%=EditEntryAction.ENTRY_TITLE%>"/>
		
		<h3><bean:write property="title" name="entryPageForm" /></h3>
		
		<logic:equal value="true" property="displayMessage" name="entryPageForm">
			<bean:message key="entry.see.oldVersion"/>
		</logic:equal>
		
		<div class="wiki">
			<jsp:getProperty property="content" name="entryPageForm" />
		</div>
		
		<p>
			<logic:equal value="true" property="canEditEntry" name="entryPageForm">
				<a href="javascript:editEntry();">
					<bean:message key="entry.edit"/>
				</a>
				&nbsp;
			</logic:equal>
			<a href="javascript:seeHistory();">
				<bean:message key="entry.history"/>
			</a>
			<logic:equal value="true" property="canDeleteEntry" name="entryPageForm">
				&nbsp;
				<a href="javascript:deleteEntry();">
					<bean:message key="entry.remove"/>
				</a>
				&nbsp;
			</logic:equal>
		</p>
	</html:form>
</div>

<%@include file="../../generic/inc/foot.jsp"%>
